// ex6_5.cpp
#include <iostream>

int main(void)
{
    using namespace std;

    double tvarp = 0.0;
    double income;
    double A = 0.0,B = 0.0,C = 0.0;

    cout << "Enter you income: ";
    cin >> income;
    cout.setf(ios_base::fixed, ios_base::floatfield);
    

    if (cin.fail())
    {
        cout << "You enter error! " << endl;
    }
    while (income > 0) 
    {
        if (income <= 5000)
        {
            tvarp = 0.0;
        }

        else if (income > 5001 && income <= 15000)
        {
            A = 10000 * 0.10;
        }
        else if (income > 15001 && income <= 35000)
        {
            B = 20000 * 0.15;
            A = 10000 * 0.10;
        }
        else if (income > 35000)
        {
            C = 3000 * 0.2;
            B = 20000 * 0.15;
            A = 10000 * 0.10;
        }
        tvarp += A + B + C;
        cout << "Your income is: " << income << endl;
        cout << "Your tax is : " << tvarp << endl;
        tvarp = 0.0;
        A = 0.0;
        B = 0.0;
        C = 0.0;
        cout << "Enter you income: ";
        cin >> income;
    }
}
